package com.buddy.summary.code.utils;

import java.util.List;


public class CommonUtil {
	
	public static final boolean isEmpty(String str) {
        return (str == null) || "".equals(str.trim()) || "null".equals(str.trim());
    }
	
	public static final boolean isNotEmpty(String str) {
        return !isEmpty(str);
    }

    public static final boolean isEmpty(Object obj) {
        return (obj == null) || "".equals(obj.toString().trim()) || "null".equals(obj.toString().trim());
    }

    public static final boolean isNotEmpty(Object obj) {
        return !isEmpty(obj);
    }
	
	public static final boolean isEmpty(String[] str) {
        return (str == null) || (str.length == 0);
    }
	
	public static final boolean isNotEmpty(String[] str) {
        return !isEmpty(str);
    }
	
	public static final boolean isEmpty(List<?> list) {
        return (list == null) || (list.size() == 0);
    }
	
	public static final boolean isNotEmpty(List<?> list) {
        return !isEmpty(list);
    }
	
	public static final boolean isContainStr(String srcText, String[] strArray){
		if(isEmpty(strArray)){
			return false;
		}
		boolean result = true;
		if(isNotEmpty(strArray)){
			for(String str : strArray){
				if(srcText.indexOf(str)==-1){
					result = false;
					break;
				}
			}
		}
		return result;
	}

}
